package com.sm.service;

import java.util.List;

import com.sm.model.HomeRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sm.dao.HomeRecordMapper;

/**
 *	首页搜索历史记录service层
 * @author 60915
 */
@Service
public class HomeRecordService {
	
	@Autowired
	private HomeRecordMapper homeRecordMapper;
	
	/**
	 *	首页根据用户id查询用户的首页搜索历史记录
	 * @param userId	用户id
	 * @return
	 */
	public List<HomeRecord> selectHomeRecords(Integer userId){
		return homeRecordMapper.selectHomeRecords(userId);
	}
	
	/**
	 *	首页根据历史记录修改搜索时间
	 * @param record
	 * @return
	 */
	public int updateByPrimaryKeySelective(HomeRecord record) {
		return homeRecordMapper.updateByPrimaryKeySelective(record);
	}
	
	/**
	 *	根据首页搜索历史插入搜索历史
	 * @param record
	 * @return
	 */
	public int insertSelective(HomeRecord record) {
		return homeRecordMapper.insertSelective(record);
	}
	
	/**
	 *	根据首页搜索历史的id删除搜索历史
	 * @param homeRecordId	首页搜索历史的id
	 * @return
	 */
	public int deleteByPrimaryKey(Integer homeRecordId) {
		return homeRecordMapper.deleteByPrimaryKey(homeRecordId);
	}
	
	/**
	 *	根据用户id清除首页的所有搜索记录
	 * @param userId	用户id
	 * @return
	 */
	public int clearHomeSearch(Integer userId) {
		return homeRecordMapper.clearHomeSearch(userId);
		
	}

}





















